#ifndef IAPENGINE_LIUYAN_H_
#define IAPENGINE_LIUYAN_H_
#include <coecntrl.h>
#include <http\mhttpdatasupplier.h>
#include <http\mhttptransactioncallback.h>
#include <http\mhttpauthenticationcallback.h>
#include <http\rhttpsession.h>
#include <es_sock.h>
//#include <apsettingshandlerui.h>
#include <centralrepository.h>
#include <ProfileEngineSDKCRKeys.h>
//#include <activeapdb.h>
// This client accepts all content types.
// (change to e.g. "text/plain" for plain text only)
_LIT8(KAccept, "*/*");

const TInt KStatustexYuebaoBufferferSize = 512;
const TInt KInfotexYuebaoBufferferSize = 64;
const TInt KURIBufferSize = 128;
const TInt KDefaulYuebaoBufferferSize = 256;

class fIapEngine : public CBase //,public MHTTPAuthenticationCallback
{
public:
    fIapEngine( const TDesC& aIapSavePath, TBool aWillConnectWap );
    virtual ~fIapEngine();
public:
    bool IsWapIap( int iap );
    void UserWapIAP();
    TBool SetupConnectionL2( RHTTPSession& aSession );
protected:
    void ProxyL( RHTTPSession & aSession, TUint32 aIapID );
    TBool ProxyInfoL( const TUint32 aGprsId, TDes &aProxyIp, TUint32 &aProxyPort );

public:
    //TBool SetupConnectionL( RHTTPSession aSession );

    /*RHTTPSession GetSession();*/
    //void SetWapConnect( );
    void SaveIap();
    void LoadIap();
    //TUint32 GetWapIap( );
    //TBool IsWapIap( TUint32 aIapId );
    //TBool IsLAN( TUint32 aIapId );
    //TBool IsUsingCmWap( );
    //void ResetConnection( TInt aIAP = 0xff );
    //TBool IsOnLine( );
private:
    //TBool FindExistingConnection( );
    //void SessionConnect( RHTTPSession &aSession );
    //TBool GetCredentialsL( const TUriC8& aURI, RString aRealm, RStringF aAuthenticationType, RString& aUsername, RString& aPassword );

private:
    RSocketServ iSocketServ;
    RConnection iConnection;
public:
    void SetIapID( TUint32 id )
    {
        iIapID = id;
    }
    TUint32 IapID()
    {
        return iIapID;
    }
private:
    TUint32 iIapID;
    //TBool iSetWapConnect;
    //CRepository* iRepository;
    TInt iPrevProfileId;
    TFileName _config;
    //TBool bCmwap;
    //TBool iHaveConnect;
    TBool iConnectionSetupDone;
    //TInt iConnectCount;
    //TBool iIsOnline;
public:
    //const TDesC8& GetUserAgent( );
    //void SetUserAgent( const TDesC8& aUserAgent );
public:
    //HBufC8* iUserAgent;
};

#endif /*IAPENGINE_LIUYAN_H_*/
